#pragma once
#ifndef __SCRIPT__EDITOR__SOLUTION_SETTINGS_HH__
#define __SCRIPT__EDITOR__SOLUTION_SETTINGS_HH__

#include "ScriptEditorPrereqs.h"
#include <qobject.h>
#include <qdialog.h>
#include <qtreewidget.h>
#include <qgroupbox.h>
#include <qlineedit.h>
#include <qtablewidget.h>
#include <qlistwidget.h>
#include "ui_ScriptSolutionSettings.h"

namespace Lit
{
	namespace Editor
	{
		namespace SolutionSettingsWidgets
		{
			class AngelWidget : public QGroupBox
			{
				QLineEdit * mName;
				QFormLayout * mLayout;
			public:
				AngelWidget( QWidget * parent );
				~AngelWidget();
			};
			class SolutionWidget : public QGroupBox
			{
				QLineEdit * mName, *mEPoint, *mREPoint;
				QFormLayout * mLayout;
			public:
				SolutionWidget( QWidget * parent ) ;
				~SolutionWidget();
				
				QLineEdit* getName(){ return mName; }
				QLineEdit* getEntryPoint(){ return mEPoint; }
				QLineEdit* getRenderEntryPoint(){ return mREPoint; }

				void prepare( ScriptSolutionPtr sol );
			};
			class SolutionIncludeWidget : public QGroupBox
			{
				QListWidget * mIncludes;
				QFormLayout * mLayout;
			public:
				SolutionIncludeWidget( QWidget * parent ) ;
				~SolutionIncludeWidget();
				
				QListWidget* getIncludes(){ return mIncludes; }

				void prepare( ScriptSolutionPtr sol );
			};
			class EditorWidget : public QGroupBox
			{
				QLineEdit * mName;
				QFormLayout * mLayout;
			public:
				EditorWidget( QWidget * parent );
				~EditorWidget();
			};
			class EngineWidget : public QGroupBox
			{
				QLineEdit * mName;
				QTabWidget * mTabs;
				QFormLayout * mLayout;
				QTableWidget * mGlobalTable;
				QTableWidget * mObjectTypes;
				QTableWidget * mEnumTable;
			public:
				EngineWidget( QWidget * parent );
				~EngineWidget();

				void prepare( ScriptEnginePtr sol );
			};
		};
		class ScriptSolutionSettings : public QDialog
		{
			Q_OBJECT

		protected:
			Ui::SolutionSettings ui;
			QTreeWidgetItem* mSolutionNode;
			QTreeWidgetItem* mSolutionIncludesNode;
			QTreeWidgetItem* mAngelNode;
			QTreeWidgetItem* mEditorNode;
			QTreeWidgetItem* mEngineNode;

			SolutionSettingsWidgets::AngelWidget * mAngelWidget;
			SolutionSettingsWidgets::SolutionIncludeWidget * mSolutionIncludeWidget;
			SolutionSettingsWidgets::SolutionWidget * mSolutionWidget;
			SolutionSettingsWidgets::EditorWidget * mEditorWidget;
			SolutionSettingsWidgets::EngineWidget * mEngineWidget;

		public:
			ScriptSolutionSettings ( QWidget*parent );
			~ScriptSolutionSettings( );
			
			int exec( ScriptSolutionPtr sol );

			SolutionSettingsWidgets::AngelWidget * getAngelWidget(){ return mAngelWidget; }
			SolutionSettingsWidgets::SolutionWidget * getSolutionWidget(){ return mSolutionWidget; }
			SolutionSettingsWidgets::SolutionIncludeWidget * getSolutionIncludeWidget(){ return mSolutionIncludeWidget; }
			SolutionSettingsWidgets::EditorWidget * getEditorWidget(){ return mEditorWidget; }
			SolutionSettingsWidgets::EngineWidget * getEngineWidget(){ return mEngineWidget; }

		protected slots:
			void updateTriggered(QTreeWidgetItem*,int);
		};
	};
};

#endif